package com.tinem.platform.module.starter.jms.util.impl;

import com.tinem.platform.module.starter.jms.enums.TopicEnum;
import com.tinem.platform.module.starter.jms.util.JmsUtil;
import lombok.extern.slf4j.Slf4j;

import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Session;

/**
 * @author fengzhihao
 * @version v1
 * @program: platform
 * @className JmsQueuesUtil
 * @description TODO
 * @site
 * @company
 * @create 2021/12/1 17:43:45
 */
@Slf4j
public class JmsQueuesUtil extends JmsUtil {
    /**
     * 发送消息
     * @param t topic
     * @param body
     * @return
     */
    @Override
    public void sendMessage(String body,String applicationName,TopicEnum t,String... args){
        jmsMessagingTemplate.convertAndSend(t.getTopic(active,applicationName,args),body);
    }

    @Override
    protected Destination getDestination(Session session,String topic) throws JMSException {
        return session.createQueue(topic);
    }
}
